API Response structure (XML)
The API response consists of two main elements:
- A Header element containing the technical result of the method call, like the error code, error message, and the path to the called API method.
- A Body element containing the business results of the method call, like amounts and transaction data.
The following tables describes the components of a general API response. For information about responses for specific methods, see API methods for Merchant and Processor APIs.
For instructions on how to view the XML response of an API call in the Merchant Information Interface, see View the XML response in the Merchant Information Interface.
Click here to download a copy of the XSD file.
If there's an error in the data format, the ErrorCode element in the Header section is different from 0. If the data format is accurate, but there is an error in the request, the Result element in the Body section shows Error.
It is recommended to always confirm that the TransactionStatus element contains the expected value for a transaction. This is especiall important for subscriptions (see Set up a subscription).
Parameter | Description |
---|---|
Result |
The result of the request, for example:
|
SurchargeAmount |
The surcharge amount applied to the transaction. |
PaReq |
The payment authentication request, which contains the details required to re-direct the card holder to the Access Control Server (ACS) for their Issuing bank. It also contains the information required to re-direct them back to your own site, once authentication has been completed. |
RedirectUrl |
The URL to send the customer to upon a successful payment request. |
RedirectResponse |
Contains information about parameters sent to a redirect URL for 3D Secure payments. For more information, see RedirectResponse and initiatePayment |
Transactions |
Contains a set of Transaction elements, each describing the relevant transactions. For more information, see Transaction. |
MerchantErrorMessage |
An error message for the merchant's eyes only, but provides more detail as to what went wrong (This is only sent to the FAIL-callback page). |
CardHolderErrorMessage |
A fallback error message that is safe to display to your customers. You are recommended to always display your own, custom error message, providing your customer with more details about the error, and only use this error message as a fallback mechanism. You must include the message for Klarna payments , or if the cardholder_message_must_be_shown return parameter is true. |
CardHolderMessageMustBeShown |
An indicator on whether the card holder error message must be shown to your customer. |
ReservedAmount |
The amount that has been reserved in the customer's account. If the payment is the type `paymentAndCapture`, this amount will be the same as CapturedAmount. |
CapturedAmount |
The amount that has been charged to the consumer. The money has initiated transit between the consumers account and your settlement account. |
RefundedAmount |
The amount that has been refunded to the consumer. The money has initiated transit between your settlement account and the consumers account. The transit may take up to 10 business days, depending on the payment method. |
ResultFilter |
The result filter shows how the results have been filtered with respect to:
|
PaymentRequestId |
The payment request ID, used for subsequent processing. |
A url you can use in a Javascript to create an overlay payement page. For more information, see Styling a floating payment window. |
|
RecurringDefaultAmount |
The default amount for a recurring payment. |
GiftCard |
Contains the AccountIdentifier and AccountAuthenticator of the gift card. |
Fundings |
Contains a set of Funding elements, each describing a specific funding. For more information, see Fundings. |
Accounts |
Contains a set of Account elements, each describing the Currency and Balance of gift card account. |
Terminals |
Contains a set of Terminal elements, that each describe a terminal. For more information, see Terminal. |
For examples of specific XML responses, see the information about the API methods for Merchant and Processor APIs, for example: